#ifndef TOURNAMENT_H
#define TOURNAMENT_H

#include "SelectionStrategy.h"
#include "Candidate.h"
#include "RandomNumberGenerator.h"
#include "EvolutionaryOperator.h"
#include "Crossover.h"

class Tournament : public SelectionStrategy
{
public:
    Tournament(float selectionProb,float mutationRate,int mutationAmount,Crossover* crossover);
    ~Tournament();
    std::vector<Candidate*> select(std::vector<Candidate*> population, int selectionSize);

    void incrementSelect(std::vector<Candidate*> population, int epochSize);
    std::vector<Candidate*> getResult(std::vector<Candidate*> population,int populationSize);
    void clearResult();
    void setMutationRate(float mutationRate);
    float mutationRate;
    int mutationAmount;
    int elitism;
    int increment;
protected:
    virtual Candidate* mutate(Candidate* candidate);
    EvolutionaryOperator *evolve;
    float selectionProb;
    Candidate* fight(Candidate* tp1, Candidate* tp2);
    std::vector<Candidate*> result;
    void determinteElite();
};

#endif // TOURNAMENT_H
